package com.pet.server.ext.service;

import java.util.List;

import com.pet.server.ext.ApiError;
import com.pet.server.ext.data.PetAdopt;
import com.pet.server.ext.data.PetMissing;
import com.pet.server.ext.dbutil.JdbcTemplate;
import com.pet.server.ext.dbutil.Sql;

public class PetService {
	private JdbcTemplate jdbcTemplate = new JdbcTemplate();
	
	public List<PetMissing> queryPetMissing(Integer size) throws ApiError{
		Sql sql = new Sql("SELECT pm.* FROM pet_missing pm WHERE 1=1");
		    sql.append(" ORDER BY pm.miss_id DESC");
		return jdbcTemplate.queryForList(sql,PetMissing.class,size);	
	}
	
	public List<PetAdopt> queryPetAdopt(Integer size) throws ApiError{
		Sql sql = new Sql("SELECT * FROM pet_adopt pa WHERE 1=1 ");
	    sql.append(" ORDER BY pa.adopt_id DESC");
	    return jdbcTemplate.queryForList(sql,PetAdopt.class,size);
	}
	
}
